package com.smart.village.big.screen.controller.micro;

import com.smart.village.big.screen.domain.AjaxResult;
import com.smart.village.big.screen.service.ChinaMobileSmsService;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import static com.smart.village.big.screen.domain.AjaxResult.success;

@Tag(name = "中国移动短信接口")
@RestController
@RequestMapping("/china/mobile/sms")
public class ChinaMobileSmsController {
    @Autowired
    private ChinaMobileSmsService chinaMobileSmsService;

    @RequestMapping("/send")
    public AjaxResult sendSms(String mobile, String content){
        try {
            return success(chinaMobileSmsService.sendSms(mobile, content));
        } catch (Exception e) {
            return AjaxResult.error(e.getMessage());
        }
    }
}
